
<?php if (sfConfig::get('app_sfSimpleForum_include_breadcrumb', true)): ?>

<?php slot('forum_navigation') ?>
<?php if ($forum): ?>
  <?php echo forum_breadcrumb(array(
    array(__(sfConfig::get('app_sfSimpleForumPlugin_forum_name', 'Forums'), null, 'sfSimpleForum'), 'sfSimpleForum/forumList'),
    array($forum->getName(), 'sfSimpleForum/forum?forum_name='.$forum->getSlug()),
    __('New topic', null, 'sfSimpleForum')
  )) ?>
<?php else: ?>
  <?php echo forum_breadcrumb(array(
    array(__(sfConfig::get('app_sfSimpleForumPlugin_forum_name', 'Forums')), 'sfSimpleForum/forumList'),
    __('New topic', null, 'sfSimpleForum')
  )) ?>
<?php endif; ?>
<?php end_slot() ?>
<?php endif; ?>

<div class="forum">
    <h1 class="title"><?php echo __('Create a new topic', null, 'sfSimpleForum') ?></h1>
    <br/>
    <div class="leftcol" style="width:auto;">
      <p>Vous êtes sur le point de créer un nouveau sujet dans le forum "<strong><?php echo $forum->get('name') ?></strong>"</p>

        <?php foreach($form as $field => $f): ?>
            <?php $attributes[$field] = array() ?>
        <?php endforeach ?>

        <?php if ($form->hasErrors()): ?>
            <?php foreach($form as $field => $f): ?>
                <?php if($f->hasError()): ?>
                    <?php $attributes[$field] = array('class' => 'error') ?>
                <?php endif ?>
            <?php endforeach ?>
            <div class="box_relief red">Certains champs sont incomplets et/ou invalides.</div>
        <?php endif; ?>

      <dl class="topic">
        <dd>
          <form action="<?php echo url_for('sfSimpleForum/createTopic?forum_name=' . $forum->get('slug')) ?>" method="post">
            <?php if(sfConfig::get('sf_csrf_secret')): echo $form['_csrf_token']->render(); endif; ?>
            <?php echo $form['forum_id']->render() ?>
              <table>
                  <tr>
                      <td></td><td><?php echo $form['title']->renderError() ?></td>
                  </tr>
                  <tr>
                      <th><label for="forum_topic_title"><?php echo $form['title']->renderLabel('Titre* :', $attributes['title']) ?></label></th>
                      <td><?php echo $form['title']->render(array('class' => 'field')) ?></td>
                  </tr>
                  <tr>
                      <td></td><td><?php echo $form['content']->renderError() ?></td>
                  </tr>
                  <tr>
                      <th class="message"><label for="forum_topic_content"><?php echo $form['content']->renderLabel('Message* :', $attributes['content']) ?></label></th>
                      <td><?php echo $form['content']->render(array('class' => 'field')) ?></td>
                  </tr>
                  <tr>
                      <td></td>
                      <td><input class="box_relief dark_blue" value="Valider" type="submit" /></td>
                  </tr>
              </table>
            <?php if($sf_user->hasCredential('moderator')): ?>
            <p>
              <label for="forum_topic_is_sticked">Épinglé</label>
              <?php echo $form['is_sticked']->renderError() ?>
              <?php echo $form['is_sticked']->render(array('class' => 'field')) ?>
            </p>
            <p>
              <label for="forum_topic_is_locked">Fermé</label>
              <?php echo $form['is_locked']->renderError() ?>
              <?php echo $form['is_locked']->render(array('class' => 'field')) ?>
            </p>
            <?php endif ?>
          </form>
        </dd>
      </dl>
    </div>
</div>